
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '     L D 2 4 1 2   S E N S O R   -   S I M P L E   R E A D E R 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 O p e n C o m P o r t 
 
 L o o p 
 
 E n d 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '     O P E N   C O M 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 L a b e l   O p e n C o m P o r t 
 
 	 N u m e r i c   B a u d s         =   2 5 6 0 0 0 
 
 	 S t r i n g     C o m P o r t 
 
 	 N u m e r i c   C o m I n d e x 
 
 	 N u m e r i c   C o m R e t r y 1 
 
 	 N u m e r i c   C o m R e t r y 2 
 
 	 F o r   C o m R e t r y 1   =   1   T o   1 0 
 
 	 	 F o r   C o m I n d e x   =   0   T o   G e t S e p a r a t e d S t r i n g C o u n t ( C O M _ P o r t N a m e s )   -   1 
 
 	 	 	 C o m P o r t   =   G e t S e p a r a t e d S t r i n g ( C O M _ P o r t N a m e s ,   C o m I n d e x ) 
 
 	 	 	 C O M   O p e n   C o m P o r t   B a u d s 
 
 	 	 	 I f   C O M _ S t a t u s   =   " O P E N E D " 
 
 	 	 	 	 F o r   C o m R e t r y 2   =   1   T o   3 
 
 	 	 	 	 	 C O M   D i s c a r d O u t B u f f e r 
 
 	 	 	 	 	 C O M   D i s c a r d I n B u f f e r 
 
 	 	 	 	 	 W a i t   S e c o n d s   0 . 0 1 
 
 	 	 	 	 	 I f   L e n ( C O M _ R e c e i v e U n t i l ( T e r m i n a t o r ) )   =   2 1 
 
 	 	 	 	 	 	 C o m I n d e x   =   - 1 
 
 	 	 	 	 	 	 B e e p   " 4 4 0 - 1 , 0 - 8 0 , 8 8 0 - 1 " 
 
 	 	 	 	 	 	 R e t u r n 
 
 	 	 	 	 	 E n d I f 
 
 	 	 	 	 N e x t 
 
 	 	 	 E n d I f 
 
 	 	 N e x t 
 
 	 N e x t 
 
 	 I f   C o m I n d e x   > =   0 
 
 	 	 P r i n t   " C O M   P O R T   N O T   F O U N D " 
 
 	 	 T T S   S e l e c t V o i c e   " E N G F " 
 
 	 	 T T S   S p e a k   " C o m   p o r t   n o t   f o u n d . " 
 
 	 	 W a i t   N o t   T T S s p e a k i n g 
 
 	 	 E n d 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   L o o p 
 
 	 R e c e i v e d L i n e   =   C O M _ R e c e i v e U n t i l ( T e r m i n a t o r ) 
 
 	 I f   R e c e i v e d L i n e   < >   " " 
 
 	 	 R e c e i v e d L i n e T o H e x L i n e 
 
 	 	 P r i n t   H e x L i n e 
 
 	 	 
 
 	 	 ' I f   L e n ( R e c e i v e d L i n e )   =   2 1 
 
 	 	 ' 	 D e c o d e R e c e i v e d L i n e 
 
 	 	 ' E n d I f 
 
 	 E n d I f 
 
 G o t o   L o o p 
 
 
 
 
 
 '   D a t a   r e c e i v e d   ( b a s i c   d a t a ) 
 
 '   F 4   F 3   F 2   F 1   0 B   0 0   0 2   A A   0 2   0 0   0 0   0 0   9 6   0 0   6 4   5 5   0 0   F 8   F 7   F 6   F 5 
 
 
 
 '   F 4   F 3   F 2   F 1     	 	 	 	 	 	 H e a d e r 
 
 '   0 B   0 0 	 	 	 	 	 	 	 	 P a y l o a d   l e n g t h   ( 1 1   o r   4 2   b y t e ) . 
 
 '   0 2   A A   0 2   0 0   0 0   0 0   9 7   0 0   6 4   5 5   0 0   	 P a y l o a d 
 
 '   F 8   F 7   F 6   F 5 	 	 	 	 	 	 T e r m i n a t o r 
 
 
 
 '   0 2   A A   0 2   0 0   0 0   0 0   9 7   0 0   6 4   5 5   0 0   	 - - - - - - - - - - - - - - - - -   P a y l o a d   ( b a s i c   d a t a ) 
 
 '     |     -     -     -     -     -     -     -     -     -     -     7     ( 6 )     ( 0 )     0 1 = E n g i n e e r i n g   0 2 = B a s i c D a t a 
 
 '           |     -     -     -     -     -     -     -     - 	   -     8     ( 7 )     ( 1 )     H E A D 
 
 '                 |     -     -     -     -     -     -     -     -     9     ( 8 )     ( 2 )     S t a t u s 
 
 '                       |     -     -     -     -     -     -     -     1 0   ( 9 )     ( 3 )     M o v i n g D i s t a n c e _ L S B 
 
 '                             |     -     -     -     -     -     -     1 1   ( 1 0 )   ( 4 )     M o v i n g D i s t a n c e _ M S B 
 
 '                                   |     -     -     -     -     -     1 2   ( 1 1 )   ( 5 )     M o v i n g S i g n a l 
 
 '                                         |     -     -     -     -     1 3   ( 1 2 )   ( 6 )     S t a t i o n a r y D i s t a n c e _ L S B 
 
 '                                               |     -     -     -     1 4   ( 1 3 )   ( 7 )     S t a t i o n a r y D i s t a n c e _ M S B 
 
 '                                                     |     -     -     1 5   ( 1 4 )   ( 8 )     S t a t i o n a r y S i g n a l 
 
 '                                                           |     -     1 6   ( 1 5 )   ( 9 )     E N D 
 
 '                                                                 |     1 7   ( 1 6 )   ( 1 0 )   C O N T R O L 
 
 
 
 '   S t a t u s   0   =   N o t h i n g   d e t e c t e d 
 
 '   S t a t u s   1   =   M o v i n g   t a r g e t   d e t e c t e d 
 
 '   S t a t u s   2   =   S t a t i o n a r y   t a r g e t   d e t e c t e d 
 
 '   S t a t u s   3   =   M o v i n g   a n d   s t a t i o n a r y   t a r g e t   d e t e c t e d 
 
 
 
 S t r i n g   T e r m i n a t o r   =   C h r ( 2 4 8 )   +   C h r ( 2 4 7 )   +   C h r ( 2 4 6 )   +   C h r ( 2 4 5 ) 
 
 S t r i n g   R e c e i v e d L i n e 
 
 N u m e r i c   S t a t u s 
 
 N u m e r i c   M o v i n g S i g n a l 
 
 N u m e r i c   M o v i n g D i s t a n c e 
 
 N u m e r i c   S t a t i o n a r y S i g n a l 
 
 N u m e r i c   S t a t i o n a r y D i s t a n c e 
 
 S t r i n g   T e x t 1 
 
 S t r i n g   T e x t 2 
 
 S t r i n g   T e x t 3 
 
 
 
 L a b e l   D e c o d e R e c e i v e d L i n e 
 
 	 S t a t u s   =   A s c ( M i d ( R e c e i v e d L i n e ,   9 ) ) 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S t a t u s 
 
 	 T e x t 1   =   " S T A T U S   "   +   S t a t u s 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S t a t i o n a r y 
 
 	 ' I f   S t a t u s   =   2   O r   S t a t u s   =   3 
 
 	 S t a t i o n a r y S i g n a l   =   A s c ( M i d ( R e c e i v e d L i n e ,   1 5 ) ) 
 
 	 S t a t i o n a r y D i s t a n c e   =   A s c ( M i d ( R e c e i v e d L i n e ,   1 3 ) ) 
 
 	 S t a t i o n a r y D i s t a n c e   =   S t a t i o n a r y D i s t a n c e   +   2 5 6   *   A s c ( M i d ( R e c e i v e d L i n e ,   1 4 ) ) 
 
 	 T e x t 2   =   "       S T A T I O N A R Y   "   +   S t a t i o n a r y S i g n a l   +   " @ "   +   S t a t i o n a r y D i s t a n c e   +   " c m " 
 
         '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M o v i n g 
 
 	 M o v i n g S i g n a l   =   A s c ( M i d ( R e c e i v e d L i n e ,   1 2 ) ) 
 
 	 I f   S t a t u s   =   3 
 
 	 	 M o v i n g D i s t a n c e   =   A s c ( M i d ( R e c e i v e d L i n e ,   1 0 ) ) 
 
 	 	 M o v i n g D i s t a n c e   =   M o v i n g D i s t a n c e   +   2 5 6   *   A s c ( M i d ( R e c e i v e d L i n e ,   1 1 ) ) 
 
 	 E n d I f 
 
 	 T e x t 3   =   "         M O V I N G   "   +   M o v i n g S i g n a l   +   " @ "   +   M o v i n g D i s t a n c e   +   " c m " 
 
         '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P r i n t 
 
 	 P r i n t   H e x L i n e   +   T e x t 1   +   T e x t 2   +   T e x t 3 
 
 R e t u r n 
 
 
 
 L a b e l   R e c e i v e d L i n e T o H e x L i n e 
 
 	 S t r i n g   H e x L i n e 
 
 	 H e x L i n e   =   " " 
 
 	 F o r   v 1   =   1   T o   L e n ( R e c e i v e d L i n e ) 
 
 	 	 H e x L i n e   =   H e x L i n e   +   R i g h t ( " 0 "   +   H e x ( A s c ( M i d ( R e c e i v e d L i n e ,   v 1 ) ) ) ,   2 )   +   "   " 
 
 	 N e x t 
 
 	 H e x L i n e   =   H e x L i n e   +   C R L F 
 
 R e t u r n 
 
 
 
 
 
 ' B O O K M A R K S   
 
 
 
 ' E D I T E D L I N E S   1 0 3   1   1 1 0   2   5 7   3   1 2   4   5 0   9   4 7   9   4 8   1 0   
 
 
 
 ' W A T C H   d u m m y 
 
 